var Format = function(fmt) { //author: meizz 
    var o = {
        "y": new Date().getFullYear(),
        "M": new Date().getMonth() + 1, //月份 
        "d": new Date().getDate(), //日 
        "h": new Date().getHours(), //小时 
        "m": new Date().getMinutes(), //分 
        "s": new Date().getSeconds(), //秒 
    };
    let newdate
    return newdate = o.y + "-" + (o.M < 10 ? "0" + o.M : o.M) + "-" + (o.d < 10 ? "0" + o.d : o.d) + " " + (o.h < 10 ? "0" + o.h : o.h) + ":" + (o.m < 10 ? "0" + o.m : o.m) + ":" + (o.s < 10 ? "0" + o.s : o.s)
}

var getWeek = function(week, isChinese) {
    if (week >= 0 && week < 7) {
        switch (week) {
            case 0:
                {
                    return isChinese ? "周日" : "Sun";
                }
            case 1:
                {
                    return isChinese ? "周一" : "Mon";
                }
            case 2:
                {
                    return isChinese ? "周二" : "Tue";
                }
            case 3:
                {
                    return isChinese ? "周三" : "Wed";
                }
            case 4:
                {
                    return isChinese ? "周四" : "Thu";
                }
            case 5:
                {
                    return isChinese ? "周五" : "Fri";
                }
            case 6:
                {
                    return isChinese ? "周六" : "Sat";
                }
        }
    }
}
var getMonth = function(month, isChinese) {
    if (month > 0 && month <= 12) {
        switch (month) {

            case 1:
                {
                    return isChinese ? "1月" : "Jan";
                }
            case 2:
                {
                    return isChinese ? "2月" : "Feb";
                }
            case 3:
                {
                    return isChinese ? "3月" : "Mar";
                }
            case 4:
                {
                    return isChinese ? "4月" : "Apr";
                }
            case 5:
                {
                    return isChinese ? "5月" : "May";
                }
            case 6:
                {
                    return isChinese ? "6月" : "Jun";
                }
            case 7:
                {
                    return isChinese ? "7月" : "Jul";
                }
            case 8:
                {
                    return isChinese ? "8月" : "Aug";
                }
            case 9:
                {
                    return isChinese ? "9月" : "Sep";
                }
            case 10:
                {
                    return isChinese ? "10月" : "Oct";
                }
            case 11:
                {
                    return isChinese ? "11月" : "Nov";
                }
            case 12:
                {
                    return isChinese ? "12月" : "Dec";
                }
        }
    }
}

module.exports = {
    Format: Format,
    getMonth:getMonth,
    getWeek:getWeek
}